package com.lagou.init;

import com.lagou.servlet.MyServlet;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import java.util.Set;

public class MySpringServletContainerInitializer extends MyServlet implements ServletContainerInitializer {

    @Override
    public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
        ServletRegistration.Dynamic dynamic = servletContext.addServlet("MyDispatcherServlet", super.getDispatcherServlet());
        dynamic.setLoadOnStartup(1);
        dynamic.addMapping("/");
    }
}
